<!-- 模块说明 -->
<template>
  <div class="container">
    <el-container>
      <el-header>
        <div class="left">
          <img src="@/assets/logo.jpg" alt="logo">
          <span>小文件存储系统</span>
        </div>
        <div class="rigtht">
          <el-button type="info" @click="logout">退出登录</el-button>
        </div>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-row class="tac">
            <!--                 @open="handleOpen"
                @close="handleClose" -->
              <el-menu
                default-active="1"
                class="aside-menu-vertical"
                router>
                <el-menu-item index="1" route='/big_file'>
                  <template slot="title">
                    <i class="el-icon-folder-opened"></i>
                    <span>大文件</span>
                  </template>
                </el-menu-item>
                <el-menu-item index="2" route='/file_tree'>
                  <template slot="title">
                    <i class="el-icon-document"></i>
                    <span>所有文件</span>
                  </template>
                </el-menu-item>
                <el-menu-item index="3" route='/file_upload'>
                  <template slot="title">
                    <i class="el-icon-upload2"></i>
                    <span>上传文件</span>
                  </template>
                </el-menu-item>
              </el-menu>
          </el-row>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
// import { getFiles } from '@/api/get_files.js'
// import { downloadFile } from '@/api/download_file.js'
export default {
  // 组件注册
  name: 'myHome',
  components: {},
  mixins: [],
  props: [],
  data () {
    return {
      // fileData: [],
      // selectedFile: [],
      // fUser: 'tester1'
    }
  },
  computed: {},
  watch: {},
  methods: {
    logout () {
      console.log('点击登出按钮')
      this.$store.state.user = ''
      this.$store.state.id = null
      this.$router.push('/login')
    }
    // // 获取文件列表函数
    // async getFileData (fUser) {
    //   const { data } = await getFiles(fUser)
    //   console.log(data)
    //   this.fileData = data
    // },
    // // 变更所选文件函数
    // row_been_selected (selection) {
    //   const tmpList = []
    //   for (const i in selection) {
    //     console.log(selection[i].f_name)
    //     tmpList.push({
    //       f_name: selection[i].f_name,
    //       f_path: selection[i].f_path
    //     })
    //   }
    //   this.selectedFile = tmpList
    //   console.log(this.selectedFile)
    // },
    // // 下载所选文件
    // async downLoadSelection (info) {
    //   window.open(`http://127.0.0.1:8000/sfile/download/?f_name=${info.f_name}&f_path=${info.f_path}&f_user=${this.fUser}`)
    // }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created () {
    // this.getFileData(this.fUser)
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted () {},
  destroyed () {}
}
</script>
<style lang="less" scoped>
  .container {
    .left {
      display: flex;
      align-items: center;
      span {
        font-size: 22px;
        padding: 0 12px;
      }
      img {
        width: 9%;
      }
    }
  }
  .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  .el-header {
    display: flex;
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 70px;
    justify-content: space-between;
    // 右侧按钮垂直居中
    align-items: center;
    // 取消el-header默认的左内边距
    padding-left: 0;
  }
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  .el-main {
    background-color: #E6EEE6;
    color: #333;
    text-align: center;
    line-height: 60px;
    border: 0;
    padding: 0;
    min-height: 915px;
  }
  // body > .el-container {
  //   margin-bottom: 40px;
  // }
  .el-menu {
    border-right: none;
  }
</style>
